package day09.Consume2Producer;/** * @Auther: sky * @Date: 2019/3/12 23:43 * @Description: */public class Consume extends Thread{    @Override    public void run() {        synchronized (Constants.lock){            while (Constants.flag){                try {                    System.out.println("我是消费者，开始等待flag:"+Constants.flag);                    Constants.lock.wait();                } catch (InterruptedException e) {                    e.printStackTrace();                }            }            System.out.println("我是消费者，获得锁"+"flag:"+Constants.flag);        }    }}